
var projectName = '动物百科系统';
/**
 * 轮播图配置
 */
var swiper = {
	// 设定轮播容器宽度，支持像素和百分比
	width: '100%',
	height: '400px',
	// hover（悬停显示）
	// always（始终显示）
	// none（始终不显示）
	arrow: 'none',
	// default（左右切换）
	// updown（上下切换）
	// fade（渐隐渐显切换）
	anim: 'default',
	// 自动切换的时间间隔
	// 默认3000
	interval: 2000,
	// 指示器位置
	// inside（容器内部）
	// outside（容器外部）
	// none（不显示）
	indicator: 'outside'
}

/**
 * 个人中心菜单
 */
var centerMenu = [{
	name: '个人中心',
	url: '../' + localStorage.getItem('userTable') + '/center.jsp'
}, 
// {
// 	name: '考试记录',
// 	url: '../examrecord/list.jsp'
// }, 
// {
// 	name: '错题本',
// 	url: '../examrecord/wrong.jsp'
// },
{
	name: '我的收藏',
	url: '../storeup/list.jsp'
}
]


var indexNav = [

{
	name: '动物百科',
	url: './pages/binweiwuzhong/list.jsp'
}, 
{
	name: '轮播图',
	url: './pages/hualang/list.jsp'
},
// {
// 	name: '商城',
// 	url: './pages/shangcheng/list.jsp'
// },

{
	name: '热点知识',
	url: './pages/exampaper/list.jsp'
}, 
{
	name: '系统公告',
	url: './pages/news/list.jsp'
},
]

var adminurl =  "http://localhost:8080/jspmvi0hf/index.jsp";

var cartFlag = false

var chatFlag = false




var menu = [{"backMenu":[{"child":[{"appFrontIcon":"cuIcon-full","buttons":["新增","查看","修改","删除"],"menu":"用户","menuJump":"列表","tableName":"yonghu"}],"menu":"用户管理"},{"child":[{"appFrontIcon":"cuIcon-send","buttons":["新增","查看","修改","删除"],"menu":"物种分类","menuJump":"列表","tableName":"wuzhongfenlei"}],"menu":"物种分类管理"},{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["新增","查看","修改","删除"],"menu":"动物保护等级","menuJump":"列表","tableName":"binweidengji"}],"menu":"动物保护等级管理"},{"child":[{"appFrontIcon":"cuIcon-discover","buttons":["新增","查看","修改","删除","查看评论"],"menu":"动物物种","menuJump":"列表","tableName":"binweiwuzhong"}],"menu":"动物物种管理"},{"child":[{"appFrontIcon":"cuIcon-goodsnew","buttons":["查看","删除","修改","查看评论"],"menu":"轮播图","menuJump":"列表","tableName":"hualang"}],"menu":"轮播图管理"},{"child":[{"appFrontIcon":"cuIcon-present","buttons":["新增","查看","修改","删除"],"menu":"商城","menuJump":"列表","tableName":"shangcheng"}],"menu":"商城管理"},{"child":[{"appFrontIcon":"cuIcon-time","buttons":["查看","删除","审核","出库"],"menu":"积分兑换","menuJump":"列表","tableName":"jifenduihuan"}],"menu":"积分兑换管理"},{"child":[{"appFrontIcon":"cuIcon-copy","buttons":["新增","查看","修改","删除"],"menu":"热点知识管理","tableName":"exampaper"}],"menu":"热点知识管理"},{"child":[{"appFrontIcon":"cuIcon-calendar","buttons":["新增","查看","修改","删除"],"menu":"题目内容管理","tableName":"examquestion"}],"menu":"题目内容管理"},{"child":[{"appFrontIcon":"cuIcon-send","buttons":["新增","查看","修改","删除"],"menu":"轮播图管理","tableName":"config"},{"appFrontIcon":"cuIcon-news","buttons":["新增","查看","修改","删除"],"menu":"系统公告","tableName":"news"}],"menu":"系统管理"},{"child":[{"appFrontIcon":"cuIcon-baby","buttons":["新增","查看","修改","删除"],"menu":"热点知识列表","tableName":"exampaperlist"},{"appFrontIcon":"cuIcon-read","buttons":["新增","查看","修改","删除"],"menu":"考试记录","tableName":"examrecord"},{"appFrontIcon":"cuIcon-attentionfavor","buttons":["新增","查看","修改","删除"],"menu":"错题本","tableName":"examfailrecord"}],"menu":"考试管理"}],"frontMenu":[{"child":[{"appFrontIcon":"cuIcon-goods","buttons":["查看","查看评论"],"menu":"动物物种列表","menuJump":"列表","tableName":"binweiwuzhong"}],"menu":"动物物种模块"},{"child":[{"appFrontIcon":"cuIcon-discover","buttons":["查看","查看评论"],"menu":"轮播图列表","menuJump":"列表","tableName":"hualang"}],"menu":"轮播图模块"},{"child":[{"appFrontIcon":"cuIcon-send","buttons":["查看","兑换"],"menu":"商城列表","menuJump":"列表","tableName":"shangcheng"}],"menu":"商城模块"}],"hasBackLogin":"是","hasBackRegister":"否","hasFrontLogin":"否","hasFrontRegister":"否","roleName":"管理员","tableName":"users"},{"backMenu":[{"child":[{"appFrontIcon":"cuIcon-discover","buttons":["新增","查看","修改","删除","查看评论"],"menu":"动物物种","menuJump":"列表","tableName":"binweiwuzhong"}],"menu":"动物危物种管理"},{"child":[{"appFrontIcon":"cuIcon-goodsnew","buttons":["新增","查看","修改","删除","查看评论"],"menu":"轮播图","menuJump":"列表","tableName":"hualang"}],"menu":"轮播图管理"},{"child":[{"appFrontIcon":"cuIcon-time","buttons":["查看","删除"],"menu":"积分兑换","menuJump":"列表","tableName":"jifenduihuan"}],"menu":"积分兑换管理"}],"frontMenu":[{"child":[{"appFrontIcon":"cuIcon-goods","buttons":["查看","查看评论"],"menu":"动物物种列表","menuJump":"列表","tableName":"binweiwuzhong"}],"menu":"动物物种模块"},{"child":[{"appFrontIcon":"cuIcon-discover","buttons":["查看","查看评论"],"menu":"轮播图列表","menuJump":"列表","tableName":"hualang"}],"menu":"轮播图模块"},{"child":[{"appFrontIcon":"cuIcon-send","buttons":["查看","兑换"],"menu":"商城列表","menuJump":"列表","tableName":"shangcheng"}],"menu":"商城模块"}],"hasBackLogin":"是","hasBackRegister":"否","hasFrontLogin":"是","hasFrontRegister":"是","roleName":"用户","tableName":"yonghu"}]


var isAuth = function (tableName,key) {
    let role = localStorage.getItem("userTable");
    let menus = menu;
    for(let i=0;i<menus.length;i++){
        if(menus[i].tableName==role){
            for(let j=0;j<menus[i].backMenu.length;j++){
                for(let k=0;k<menus[i].backMenu[j].child.length;k++){
                    if(tableName==menus[i].backMenu[j].child[k].tableName){
                        let buttons = menus[i].backMenu[j].child[k].buttons.join(',');
                        return buttons.indexOf(key) !== -1 || false
                    }
                }
            }
        }
    }
    return false;
}

var isFrontAuth = function (tableName,key) {
    let role = localStorage.getItem("userTable");
    let menus = menu;
    for(let i=0;i<menus.length;i++){
        if(menus[i].tableName==role){
            for(let j=0;j<menus[i].frontMenu.length;j++){
                for(let k=0;k<menus[i].frontMenu[j].child.length;k++){
                    if(tableName==menus[i].frontMenu[j].child[k].tableName){
                        let buttons = menus[i].frontMenu[j].child[k].buttons.join(',');
                        return buttons.indexOf(key) !== -1 || false
                    }
                }
            }
        }
    }
    return false;
}
